<?php

/**
 * 当前应用程序的配置，可以添加自定义配置项，并可使用 Core\HHO::$config 引用到指定的 HHO 配置项的默认值
 *
 */
function HHO_APP_CONFIG() {
	$config = array();
	
	if ($_SERVER['SERVER_ADDR'] == '127.0.0.1') { // 开发环境
		$config['session'] = FALSE;
		$config['data.root'] = HHO_APP_PATH . '/Data';
		//$config['dsn'] = array('apps' => array("sqlite:{$config['data.root']}/apps.sqlite"));
		$config['dsn'] = ['apps' => ['mysql:host=127.0.0.1;port=3306;dbname=apps;', 'root', 'root', 'utf8']];
		$config['debug'] = TRUE;
		$config['error.log'] = 2;
		$config['404.html'] = Core\HHO::$config['view.root'] . '/' . Core\HHO::$config['view.default'] . '/404.php';
		$config['mcsn'] = ['apc' => ['driver' => 'apc', 'prefix' => 'APPS:'], 'main' => ['driver' => 'redis', 'host' => 'localhost', 'prefix' => 'DEV:']];
	} elseif ($_SERVER['SERVER_ADDR'] == '192.168.1.20') { // ThinkPad 生产环境
		$config['session'] = FALSE;
		$config['data.root'] = HHO_APP_PATH . '/Data';
		//$config['dsn'] = array('apps' => array("sqlite:{$config['data.root']}/apps.sqlite"));
		$config['dsn'] = ['apps' => ['mysql:host=192.168.1.80;port=3306;dbname=apps;', 'root', 'root', 'utf8']];
		$config['debug'] = FALSE;
		$config['error.log'] = 2;
		$config['404.html'] = Core\HHO::$config['view.root'] . '/' . Core\HHO::$config['view.default'] . '/404.php';
		$config['mcsn'] = ['apc' => ['driver' => 'apc', 'prefix' => 'APPS:'], 'main' => ['driver' => 'redis', 'host' => 'localhost', 'prefix' => 'DEV:']];
	} else { // 生产环境
		$config['session'] = FALSE;
		$config['data.root'] = HHO_APP_PATH . '/Data';
		//$config['dsn'] = array('apps' => array("sqlite:{$config['data.root']}/apps.sqlite"));
		$config['dsn'] = ['apps' => ['mysql:host=192.168.1.100;port=3306;dbname=apps;', 'root', 'root', 'utf8']];
		$config['debug'] = FALSE;
		$config['error.log'] = 2;
		$config['404.html'] = Core\HHO::$config['view.root'] . '/' . Core\HHO::$config['view.default'] . '/404.php';
		$config['mcsn'] = ['apc' => ['driver' => 'apc', 'prefix' => 'APPS:'], 'main' => ['driver' => 'redis', 'host' => 'localhost', 'prefix' => 'APPS:']];
	}
	
	return $config;
}